package com.baizhi.service.impl;

import com.baizhi.dao.BannerDao;
import com.baizhi.entity.Banner;
import com.baizhi.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Lenovo on 2019/6/20.
 */
@Service
public class BannerServiceImpl implements BannerService {

    @Autowired
    private BannerDao bannerDao;

    //分页查询轮播图
    @Override
    public Map fenye(int page, int rows) {
        Map map=new HashMap();
        int total = bannerDao.total();
        map.put("total",total);
        int start=(page-1)*rows;
        int pageSize=page*rows;
        List<Banner> list = bannerDao.fenye(start, pageSize);
        map.put("rows",list);
        return map;
    }
}
